﻿using System;
using System.Collections.Generic;
using KKSG;
using UILib;
using XMainClient.UI;
using XUtliPoolLib;

namespace XMainClient
{
	// Token: 0x020009C9 RID: 2505
	internal class XBagDocument : XDocComponent
	{
		// Token: 0x17002D9A RID: 11674
		// (get) Token: 0x0600978C RID: 38796 RVA: 0x00171878 File Offset: 0x0016FA78
		public override uint ID
		{
			get
			{
				return XBagDocument.uuID;
			}
		}

		// Token: 0x17002D9B RID: 11675
		// (get) Token: 0x0600978D RID: 38797 RVA: 0x00171890 File Offset: 0x0016FA90
		public static DropList DropTable
		{
			get
			{
				return XBagDocument.m_DropTable;
			}
		}

		// Token: 0x17002D9C RID: 11676
		// (get) Token: 0x0600978E RID: 38798 RVA: 0x001718A8 File Offset: 0x0016FAA8
		public static XBagDocument BagDoc
		{
			get
			{
				return XSingleton<XGame>.singleton.Doc.XBagDoc;
			}
		}

		// Token: 0x0600978F RID: 38799 RVA: 0x001718CC File Offset: 0x0016FACC
		public void GetItemsByType(ulong typeFilter, ref List<XItem> list)
		{
			for (int i = 0; i < this.ItemBag.Count; i++)
			{
				ulong num = 1UL << (int)this.ItemBag[i].type;
				bool flag = (num & typeFilter) > 0UL;
				if (flag)
				{
					list.Add(this.ItemBag[i]);
				}
			}
		}

		// Token: 0x06009790 RID: 38800 RVA: 0x00171930 File Offset: 0x0016FB30
		public List<XItem> GetNotBindItemsByType(int typeFilter)
		{
			List<XItem> list = new List<XItem>();
			for (int i = 0; i < this.ItemBag.Count; i++)
			{
				bool bBinding = this.ItemBag[i].bBinding;
				if (!bBinding)
				{
					int num = 1 << (int)this.ItemBag[i].type;
					bool flag = (num & typeFilter) > 0;
					if (flag)
					{
						list.Add(this.ItemBag[i]);
					}
				}
			}
			return list;
		}

		// Token: 0x06009791 RID: 38801 RVA: 0x001719B8 File Offset: 0x0016FBB8
		public List<XItem> GetItemsByTypeAndQuality(ulong typeFilter, ItemQuality quality)
		{
			List<XItem> list = new List<XItem>();
			for (int i = 0; i < this.ItemBag.Count; i++)
			{
				ulong num = 1UL << (int)this.ItemBag[i].type;
				bool flag = (num & typeFilter) > 0UL && (ItemQuality)this.ItemBag[i].itemConf.ItemQuality == quality;
				if (flag)
				{
					list.Add(this.ItemBag[i]);
				}
			}
			return list;
		}

		// Token: 0x06009792 RID: 38802 RVA: 0x00171A48 File Offset: 0x0016FC48
		public static void Execute(OnLoadedCallback callback = null)
		{
			XBagDocument.AsyncLoader.AddTask("Table/ItemList", XBagDocument.m_ItemTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/ChestList", XBagDocument.m_ChestTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/EquipList", XBagDocument.m_EquipTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/FashionList", XBagDocument.m_FashionTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/EmblemBasic", XBagDocument.m_EmblemTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/DropList", XBagDocument.m_DropTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/PandoraHeart", XBagDocument.m_PandoraHeartTable, false);
			XBagDocument.AsyncLoader.AddTask("Table/BagExpandItemList", XBagDocument.m_BagExpandItemListTable, false);
			XBagDocument.AsyncLoader.Execute(callback);
			XBagDocument.m_ChestRange.Clear();
			XBagDocument.m_AuctionRange.Clear();
		}

		// Token: 0x06009793 RID: 38803 RVA: 0x00171B28 File Offset: 0x0016FD28
		public static void OnTableLoaded()
		{
			XBagDocument.BuildChestTable();
			XBagDocument.BuildAuctionRange();
		}

		// Token: 0x06009794 RID: 38804 RVA: 0x00171B38 File Offset: 0x0016FD38
		public static void BuildAuctionRange()
		{
			ItemList.RowData[] table = XBagDocument.m_ItemTable.Table;
			int i = 0;
			int num = table.Length;
			while (i < num)
			{
				ItemList.RowData rowData = table[i];
				bool flag = !rowData.CanTrade || rowData.AuctionType == null;
				if (!flag)
				{
					int j = 0;
					int num2 = rowData.AuctionType.Length;
					while (j < num2)
					{
						List<ItemList.RowData> list;
						bool flag2 = !XBagDocument.m_AuctionRange.TryGetValue((uint)rowData.AuctionType[j], out list);
						if (flag2)
						{
							list = new List<ItemList.RowData>();
							XBagDocument.m_AuctionRange.Add((uint)rowData.AuctionType[j], list);
						}
						list.Add(rowData);
						j++;
					}
				}
				i++;
			}
		}

		// Token: 0x06009795 RID: 38805 RVA: 0x00171BF8 File Offset: 0x0016FDF8
		public static void BuildChestTable()
		{
			int i = 0;
			int num = XBagDocument.m_ChestTable.Table.Length;
			while (i < num)
			{
				List<ChestList.RowData> list;
				bool flag = !XBagDocument.m_ChestRange.TryGetValue(XBagDocument.m_ChestTable.Table[i].ItemID, out list);
				if (flag)
				{
					list = new List<ChestList.RowData>();
					XBagDocument.m_ChestRange.Add(XBagDocument.m_ChestTable.Table[i].ItemID, list);
				}
				list.Add(XBagDocument.m_ChestTable.Table[i]);
				i++;
			}
		}

		// Token: 0x06009796 RID: 38806 RVA: 0x00171C84 File Offset: 0x0016FE84
		public static bool TryGetAuctionList(uint auctionID, out List<ItemList.RowData> list)
		{
			return XBagDocument.m_AuctionRange.TryGetValue(auctionID, out list);
		}

		// Token: 0x06009797 RID: 38807 RVA: 0x00171CA4 File Offset: 0x0016FEA4
		public static uint GetItemProf(int itemid)
		{
			ItemList.RowData byItemID = XBagDocument.m_ItemTable.GetByItemID(itemid);
			bool flag = byItemID == null;
			uint result;
			if (flag)
			{
				result = 0U;
			}
			else
			{
				result = (uint)byItemID.Profession;
			}
			return result;
		}

		// Token: 0x06009798 RID: 38808 RVA: 0x00171CD4 File Offset: 0x0016FED4
		public static int ConvertTemplate(ItemList.RowData rowData)
		{
			bool flag = rowData == null;
			int result;
			if (flag)
			{
				result = 0;
			}
			else
			{
				bool flag2 = rowData.ItemType == 12;
				if (flag2)
				{
					result = rowData.ItemID + (int)(XItemDrawerParam.DefaultProfession * XBagDocument.ITEM_PROFESSION_MASK);
				}
				else
				{
					result = rowData.ItemID;
				}
			}
			return result;
		}

		// Token: 0x06009799 RID: 38809 RVA: 0x00171D1C File Offset: 0x0016FF1C
		public static int ConvertTemplate(int itemid)
		{
			ItemList.RowData byItemID = XBagDocument.m_ItemTable.GetByItemID(itemid);
			bool flag = byItemID == null;
			int result;
			if (flag)
			{
				result = itemid;
			}
			else
			{
				result = XBagDocument.ConvertTemplate(byItemID);
			}
			return result;
		}

		// Token: 0x0600979A RID: 38810 RVA: 0x00171D4C File Offset: 0x0016FF4C
		public static bool IsProfMatched(uint prof)
		{
			return prof == 0U || prof % 10U == XItemDrawerParam.DefaultProfession;
		}

		// Token: 0x0600979B RID: 38811 RVA: 0x00171D70 File Offset: 0x0016FF70
		public static bool IsProfMatchedFeable(uint prof, uint profecssion, bool feable = false)
		{
			return prof == 0U || (feable ? (prof % 10U == profecssion % 10U) : (prof == profecssion));
		}

		// Token: 0x0600979C RID: 38812 RVA: 0x00171D9C File Offset: 0x0016FF9C
		public static bool IsProfMatchedWithFeable(uint prof)
		{
			return prof == 0U || prof == XItemDrawerParam.DefaultProfession;
		}

		// Token: 0x0600979D RID: 38813 RVA: 0x00171DBC File Offset: 0x0016FFBC
		public static bool IsProfEqual(uint prof)
		{
			return prof % 10U == XItemDrawerParam.DefaultProfession;
		}

		// Token: 0x0600979E RID: 38814 RVA: 0x00171DDC File Offset: 0x0016FFDC
		public static string GetItemSmallIcon(int itemid, uint profession = 0U)
		{
			ItemList.RowData itemConf = XBagDocument.GetItemConf(itemid);
			bool flag = itemConf == null;
			string result;
			if (flag)
			{
				result = string.Empty;
			}
			else
			{
				result = XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemIcon1, profession);
			}
			return result;
		}

		// Token: 0x0600979F RID: 38815 RVA: 0x00171E18 File Offset: 0x00170018
		public static void GetItemBigIconAndAtlas(int itemid, out string icon, out string atlas, uint profession = 0U)
		{
			ItemList.RowData itemConf = XBagDocument.GetItemConf(itemid);
			bool flag = itemConf == null;
			if (flag)
			{
				icon = string.Empty;
				atlas = string.Empty;
			}
			else
			{
				icon = XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemIcon, profession);
				atlas = XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemAtlas, profession);
			}
		}

		// Token: 0x060097A0 RID: 38816 RVA: 0x00171E70 File Offset: 0x00170070
		public static void GetItemSmallIconAndAtlas(int itemid, out string icon, out string atlas, uint profession = 0U)
		{
			ItemList.RowData itemConf = XBagDocument.GetItemConf(itemid);
			bool flag = itemConf == null;
			if (flag)
			{
				icon = string.Empty;
				atlas = string.Empty;
			}
			else
			{
				icon = XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemIcon1, profession);
				atlas = XSingleton<UiUtility>.singleton.ChooseProfString(itemConf.ItemAtlas1, profession);
			}
		}

		// Token: 0x060097A1 RID: 38817 RVA: 0x00171EC8 File Offset: 0x001700C8
		public static uint GetAuctionRecommendPrice(int itemID)
		{
			return XBagDocument.m_ItemTable.GetByItemID(itemID).AuctPriceRecommend;
		}

		// Token: 0x060097A2 RID: 38818 RVA: 0x00171EEC File Offset: 0x001700EC
		public static FashionList.RowData GetFashionConf(int itemID)
		{
			return XBagDocument.m_FashionTable.GetByItemID(itemID);
		}

		// Token: 0x060097A3 RID: 38819 RVA: 0x00171F0C File Offset: 0x0017010C
		public static ItemList.RowData GetItemConf(int itemID)
		{
			return XBagDocument.m_ItemTable.GetByItemID(itemID);
		}

		// Token: 0x060097A4 RID: 38820 RVA: 0x00171F2C File Offset: 0x0017012C
		public static EquipList.RowData GetEquipConf(int itemID)
		{
			return XBagDocument.m_EquipTable.GetByItemID(itemID);
		}

		// Token: 0x060097A5 RID: 38821 RVA: 0x00171F4C File Offset: 0x0017014C
		public static BagExpandItemListTable.RowData GetExpandItemConf(uint itemId)
		{
			return XBagDocument.m_BagExpandItemListTable.GetByItemId(itemId);
		}

		// Token: 0x060097A6 RID: 38822 RVA: 0x00171F6C File Offset: 0x0017016C
		public static BagExpandItemListTable.RowData GetExpandItemConfByType(uint itemId)
		{
			return XBagDocument.m_BagExpandItemListTable.GetByType(itemId);
		}

		// Token: 0x17002D9D RID: 11677
		// (get) Token: 0x060097A7 RID: 38823 RVA: 0x00171F8C File Offset: 0x0017018C
		public static PandoraHeart PandoraHeartTable
		{
			get
			{
				return XBagDocument.m_PandoraHeartTable;
			}
		}

		// Token: 0x060097A8 RID: 38824 RVA: 0x00171FA4 File Offset: 0x001701A4
		public static PandoraHeart.RowData GetPandoraHeartConf(int itemID, uint profID)
		{
			for (int i = 0; i < XBagDocument.m_PandoraHeartTable.Table.Length; i++)
			{
				bool flag = ((long)itemID == (long)((ulong)XBagDocument.m_PandoraHeartTable.Table[i].PandoraID) || (long)itemID == (long)((ulong)XBagDocument.m_PandoraHeartTable.Table[i].FireID)) && (profID == XBagDocument.m_PandoraHeartTable.Table[i].ProfID || XBagDocument.m_PandoraHeartTable.Table[i].ProfID == 0U);
				if (flag)
				{
					return XBagDocument.m_PandoraHeartTable.Table[i];
				}
			}
			return null;
		}

		// Token: 0x060097A9 RID: 38825 RVA: 0x00172044 File Offset: 0x00170244
		public static EmblemBasic.RowData GetEmblemConf(int emblemID)
		{
			return XBagDocument.m_EmblemTable.GetByEmblemID((uint)emblemID);
		}

		// Token: 0x060097AA RID: 38826 RVA: 0x00172064 File Offset: 0x00170264
		public static ChestList.RowData GetChestConf(int itemID)
		{
			for (int i = 0; i < XBagDocument.m_ChestTable.Table.Length; i++)
			{
				bool flag = XBagDocument.m_ChestTable.Table[i].ItemID == itemID;
				if (flag)
				{
					return XBagDocument.m_ChestTable.Table[i];
				}
			}
			return null;
		}

		// Token: 0x060097AB RID: 38827 RVA: 0x001720BC File Offset: 0x001702BC
		public static bool TryGetChestListConf(int itemID, out List<ChestList.RowData> chestList)
		{
			return XBagDocument.m_ChestRange.TryGetValue(itemID, out chestList);
		}

		// Token: 0x060097AC RID: 38828 RVA: 0x001720DC File Offset: 0x001702DC
		private static int DropDataCompare(DropList.RowData rowData, int dropID)
		{
			return dropID.CompareTo(rowData.DropID);
		}

		// Token: 0x060097AD RID: 38829 RVA: 0x001720FC File Offset: 0x001702FC
		public static bool TryGetDropConf(uint[] dropIDs, ref List<DropList.RowData> dropList)
		{
			bool flag = dropIDs != null;
			if (flag)
			{
				for (int i = 0; i < dropIDs.Length; i++)
				{
					int num;
					int num2;
					CVSReader.GetRowDataListByField<DropList.RowData, int>(XBagDocument.DropTable.Table, (int)dropIDs[i], out num, out num2, XBagDocument.comp);
					bool flag2 = num < 0;
					if (!flag2)
					{
						for (int j = num; j <= num2; j++)
						{
							dropList.Add(XBagDocument.DropTable.Table[j]);
						}
					}
				}
			}
			return dropList.Count > 0;
		}

		// Token: 0x060097AE RID: 38830 RVA: 0x00172190 File Offset: 0x00170390
		public override void OnAttachToHost(XObject host)
		{
			base.OnAttachToHost(host);
			this.ItemBag = new XBag();
		}

		// Token: 0x060097AF RID: 38831 RVA: 0x001721A6 File Offset: 0x001703A6
		protected override void EventSubscribe()
		{
			base.EventSubscribe();
			base.RegisterEvent(XEventDefine.XEvent_RemoveItem, new XComponent.XEventHandler(this.OnRemoveItem));
			base.RegisterEvent(XEventDefine.XEvent_UpdateItem, new XComponent.XEventHandler(this.OnUpdateItem));
		}

		// Token: 0x060097B0 RID: 38832 RVA: 0x001721DC File Offset: 0x001703DC
		protected bool OnRemoveItem(XEventArgs args)
		{
			XRemoveItemEventArgs xremoveItemEventArgs = args as XRemoveItemEventArgs;
			foreach (ulong uid in xremoveItemEventArgs.uids)
			{
				this._RemoveCompareAttrsFromPool(uid);
			}
			return true;
		}

		// Token: 0x060097B1 RID: 38833 RVA: 0x00172244 File Offset: 0x00170444
		protected bool OnUpdateItem(XEventArgs args)
		{
			XUpdateItemEventArgs xupdateItemEventArgs = args as XUpdateItemEventArgs;
			this._RemoveCompareAttrsFromPool(xupdateItemEventArgs.item.uid);
			return true;
		}

		// Token: 0x060097B2 RID: 38834 RVA: 0x00172270 File Offset: 0x00170470
		public override void OnLeaveScene()
		{
			base.OnLeaveScene();
			this.basicAttrPool.Clear();
			this.equipAdditionalAttrPool.Clear();
			this.getallEquip = false;
		}

		// Token: 0x060097B3 RID: 38835 RVA: 0x0017229C File Offset: 0x0017049C
		public BagExpandData GetBagExpandData(BagType type)
		{
			for (int i = 0; i < this.BagExpandDataList.Count; i++)
			{
				bool flag = this.BagExpandDataList[i].Type == type;
				if (flag)
				{
					return this.BagExpandDataList[i];
				}
			}
			return null;
		}

		// Token: 0x060097B4 RID: 38836 RVA: 0x001722F4 File Offset: 0x001704F4
		public void SwapItem(ulong uid1, ulong uid2)
		{
			int num = 0;
			XItem xitem = null;
			XItem xitem2 = null;
			bool flag = uid1 != 0UL && this.ItemBag.FindItem(uid1, out num);
			if (flag)
			{
				xitem = this.ItemBag[num];
			}
			int num2 = 0;
			XBodyBag xbodyBag = null;
			bool flag2 = false;
			bool flag3 = uid2 != 0UL && this.GetBodyPosByUID(uid2, out num2, out xbodyBag, out flag2);
			if (flag3)
			{
				xitem2 = xbodyBag[num2];
			}
			bool flag4 = xitem != null && xitem2 != null;
			if (flag4)
			{
				bool flag5 = xitem.type != xitem2.type;
				if (!flag5)
				{
					this.ItemBag[num] = xitem2;
					xbodyBag[num2] = xitem;
					this.ItemBag.SortItem();
					XSwapItemEventArgs @event = XEventPool<XSwapItemEventArgs>.GetEvent();
					@event.itemNowOnBody = xitem;
					@event.itemNowInBag = xitem2;
					@event.slot = num2;
					@event.Firer = XSingleton<XGame>.singleton.Doc;
					XSingleton<XEventMgr>.singleton.FireEvent(@event);
				}
			}
			else
			{
				bool flag6 = xitem != null;
				if (flag6)
				{
					xbodyBag = xitem.Description.BodyBag;
					bool flag7 = xbodyBag == null;
					if (!flag7)
					{
						ItemType type = xitem.Type;
						if (type != ItemType.EQUIP)
						{
							if (type != ItemType.EMBLEM)
							{
								if (type == ItemType.ARTIFACT)
								{
									ArtifactListTable.RowData artifactListRowData = ArtifactDocument.GetArtifactListRowData((uint)xitem.itemID);
									num2 = (int)artifactListRowData.ArtifactPos;
									flag2 = true;
								}
							}
							else
							{
								EmblemBasic.RowData emblemConf = XBagDocument.GetEmblemConf(xitem.itemID);
								bool flag8 = !XEmblemDocument.GetFirstEmptyEmblemSlot(this.EmblemBag, emblemConf.EmblemType, out num2);
								if (flag8)
								{
									XSingleton<XDebug>.singleton.AddErrorLog("Failed to equip emblem cause it's full.", null, null, null, null, null);
									return;
								}
							}
						}
						else
						{
							EquipList.RowData equipConf = XBagDocument.GetEquipConf(xitem.itemID);
							num2 = (int)equipConf.EquipPos;
							flag2 = true;
						}
						xbodyBag[num2] = xitem;
						this.ItemBag.RemoveIndex(num);
						XRemoveItemEventArgs event2 = XEventPool<XRemoveItemEventArgs>.GetEvent();
						event2.uids.Add(uid1);
						event2.types.Add(xitem.Type);
						event2.ids.Add(xitem.itemID);
						event2.Firer = XSingleton<XGame>.singleton.Doc;
						XSingleton<XEventMgr>.singleton.FireEvent(event2);
						XLoadEquipEventArgs event3 = XEventPool<XLoadEquipEventArgs>.GetEvent();
						event3.item = xitem;
						event3.slot = num2;
						event3.Firer = XSingleton<XGame>.singleton.Doc;
						XSingleton<XEventMgr>.singleton.FireEvent(event3);
					}
				}
				else
				{
					bool flag9 = xitem2 != null;
					if (flag9)
					{
						xbodyBag[num2] = null;
						this.ItemBag.AddItem(xitem2, true);
						XAddItemEventArgs event4 = XEventPool<XAddItemEventArgs>.GetEvent();
						event4.items.Add(xitem2);
						event4.Firer = XSingleton<XGame>.singleton.Doc;
						event4.bNew = false;
						XSingleton<XEventMgr>.singleton.FireEvent(event4);
						XUnloadEquipEventArgs event5 = XEventPool<XUnloadEquipEventArgs>.GetEvent();
						event5.slot = num2;
						event5.item = xitem2;
						event5.type = xitem2.Type;
						event5.Firer = XSingleton<XGame>.singleton.Doc;
						XSingleton<XEventMgr>.singleton.FireEvent(event5);
					}
				}
			}
		}

		// Token: 0x060097B5 RID: 38837 RVA: 0x00172618 File Offset: 0x00170818
		public void UseItem(XItem item, uint opType = 0U)
		{
			RpcC2G_UseItem rpcC2G_UseItem = new RpcC2G_UseItem();
			rpcC2G_UseItem.oArg.uid = item.uid;
			rpcC2G_UseItem.oArg.count = 1U;
			rpcC2G_UseItem.oArg.OpType = opType;
			rpcC2G_UseItem.oArg.itemID = (uint)item.itemID;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_UseItem);
		}

		// Token: 0x060097B6 RID: 38838 RVA: 0x00172678 File Offset: 0x00170878
		public void UseItem(XItem item, uint opType, uint count)
		{
			RpcC2G_UseItem rpcC2G_UseItem = new RpcC2G_UseItem();
			rpcC2G_UseItem.oArg.uid = item.uid;
			rpcC2G_UseItem.oArg.count = count;
			rpcC2G_UseItem.oArg.OpType = opType;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_UseItem);
		}

		// Token: 0x060097B7 RID: 38839 RVA: 0x001726C4 File Offset: 0x001708C4
		private static void MakeXEquipItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				item = XDataPool<XEquipItem>.GetData();
			}
			XEquipItem xequipItem = item as XEquipItem;
			bool flag2 = xequipItem == null;
			if (flag2)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Cant create XEquipItem", null, null, null, null, null);
			}
			else
			{
				xequipItem.smeltDegreeNum = KKSGItem.smeltCount;
				xequipItem.enhanceInfo.EnhanceLevel = KKSGItem.EnhanceLevel;
				xequipItem.enhanceInfo.EnhanceTimes = KKSGItem.EnhanceCount;
				bool flag3 = KKSGItem.AttrID.Count != KKSGItem.AttrValue.Count;
				if (flag3)
				{
					XSingleton<XDebug>.singleton.AddLog("KKSGItem.EnhanceInfo.AttrID.Count != KKSGItem.EnhanceInfo.AttrValue.Count", null, null, null, null, null, XDebugColor.XDebug_None);
				}
				else
				{
					for (int i = 0; i < KKSGItem.EnhanceAttrId.Count; i++)
					{
						XItemChangeAttr item2;
						item2.AttrID = KKSGItem.EnhanceAttrId[i];
						item2.AttrValue = KKSGItem.EnhanceAttrValue[i];
						xequipItem.enhanceInfo.EnhanceAttr.Add(item2);
					}
					xequipItem.changeAttr.Clear();
					EquipList.RowData equipConf = XBagDocument.GetEquipConf((int)KKSGItem.ItemID);
					bool flag4 = equipConf != null;
					if (flag4)
					{
						for (int j = 0; j < (int)equipConf.Attributes.count; j++)
						{
							XItemChangeAttr item3;
							item3.AttrID = (uint)equipConf.Attributes[j, 0];
							item3.AttrValue = (uint)equipConf.Attributes[j, 1];
							xequipItem.changeAttr.Add(item3);
						}
					}
					bool flag5 = KKSGItem.ItemJade != null;
					if (flag5)
					{
						for (int k = 0; k < KKSGItem.ItemJade.ItemJadeSingle.Count; k++)
						{
							ItemJadeSingle itemJadeSingle = KKSGItem.ItemJade.ItemJadeSingle[k];
							XJadeItem data = XDataPool<XJadeItem>.GetData();
							data.itemID = (int)itemJadeSingle.ItemId;
							data.type = (uint)XFastEnumIntEqualityComparer<ItemType>.ToInt(ItemType.JADE);
							data.uid = 0UL;
							data.itemCount = 1;
							data.bBinding = true;
							for (int l = 0; l < itemJadeSingle.AttrId.Count; l++)
							{
								uint attrID = itemJadeSingle.AttrId[l];
								XItemChangeAttr item4;
								item4.AttrID = attrID;
								item4.AttrValue = itemJadeSingle.AttrValue[l];
								data.changeAttr.Add(item4);
							}
							xequipItem.jadeInfo.jades[(int)itemJadeSingle.SlotPos] = data;
						}
					}
					xequipItem.attrType = AttrType.None;
					bool flag6 = KKSGItem.randAttr != null;
					if (flag6)
					{
						for (int m = 0; m < KKSGItem.randAttr.attrs.Count; m++)
						{
							XItemChangeAttr xitemChangeAttr;
							xitemChangeAttr.AttrID = KKSGItem.randAttr.attrs[m].id;
							xitemChangeAttr.AttrValue = KKSGItem.randAttr.attrs[m].value;
							xequipItem.randAttrInfo.RandAttr.Add(xitemChangeAttr);
							bool flag7 = xequipItem.attrType > AttrType.None;
							if (!flag7)
							{
								bool flag8 = xitemChangeAttr.AttrID == 11U;
								if (flag8)
								{
									xequipItem.attrType = AttrType.Physics;
								}
								else
								{
									bool flag9 = xitemChangeAttr.AttrID == 21U;
									if (flag9)
									{
										xequipItem.attrType = AttrType.Magic;
									}
								}
							}
						}
					}
					bool flag10 = KKSGItem.forge != null;
					if (flag10)
					{
						for (int n = 0; n < KKSGItem.forge.attrs.Count; n++)
						{
							XItemChangeAttr item5;
							item5.AttrID = KKSGItem.forge.attrs[n].id;
							item5.AttrValue = KKSGItem.forge.attrs[n].value;
							xequipItem.forgeAttrInfo.ForgeAttr.Add(item5);
						}
						bool flag11 = KKSGItem.forge.unReplacedAttr != null;
						if (flag11)
						{
							xequipItem.forgeAttrInfo.UnSavedAttrid = KKSGItem.forge.unReplacedAttr.id;
							xequipItem.forgeAttrInfo.UnSavedAttrValue = KKSGItem.forge.unReplacedAttr.value;
						}
						else
						{
							xequipItem.forgeAttrInfo.UnSavedAttrid = 0U;
							xequipItem.forgeAttrInfo.UnSavedAttrValue = 0U;
						}
					}
					bool flag12 = KKSGItem.enchant != null;
					if (flag12)
					{
						xequipItem.enchantInfo.ChooseAttr = KKSGItem.enchant.chooseAttrid;
						bool flag13 = KKSGItem.enchant.chooseAttrid > 0U;
						if (flag13)
						{
							for (int num = 0; num < KKSGItem.enchant.allAttrs.Count; num++)
							{
								XItemChangeAttr item6;
								item6.AttrID = KKSGItem.enchant.allAttrs[num].id;
								item6.AttrValue = KKSGItem.enchant.allAttrs[num].value;
								xequipItem.enchantInfo.AttrList.Add(item6);
							}
							bool flag14 = KKSGItem.enchant.enchantids.Count > 0;
							if (flag14)
							{
								xequipItem.enchantInfo.EnchantIDList = new List<uint>(KKSGItem.enchant.enchantids);
							}
						}
						xequipItem.enchantInfo.EnchantItemID = (int)KKSGItem.enchant.enchantid;
					}
					bool flag15 = KKSGItem.fuse != null;
					if (flag15)
					{
						xequipItem.fuseInfo.BreakNum = KKSGItem.fuse.fuseLevel;
						xequipItem.fuseInfo.FuseExp = KKSGItem.fuse.fuseExpCount;
					}
				}
			}
		}

		// Token: 0x060097B8 RID: 38840 RVA: 0x00172C6C File Offset: 0x00170E6C
		private static void MakeXArtifactItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				item = XDataPool<XArtifactItem>.GetData();
			}
			XArtifactItem xartifactItem = item as XArtifactItem;
			bool flag2 = xartifactItem == null;
			if (flag2)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Can not create artifactItem", null, null, null, null, null);
			}
			else
			{
				xartifactItem.RandAttrInfo.RandAttr.Clear();
				for (int i = 0; i < KKSGItem.AttrID.Count; i++)
				{
					XItemChangeAttr item2;
					item2.AttrID = KKSGItem.AttrID[i];
					item2.AttrValue = KKSGItem.AttrValue[i];
					xartifactItem.RandAttrInfo.RandAttr.Add(item2);
				}
				bool flag3 = KKSGItem.artifact != null;
				if (flag3)
				{
					for (int j = 0; j < KKSGItem.artifact.unReplacedAttr.Count; j++)
					{
						XItemChangeAttr item3 = default(XItemChangeAttr);
						item3.AttrID = KKSGItem.artifact.unReplacedAttr[j].id;
						item3.AttrValue = KKSGItem.artifact.unReplacedAttr[j].value;
						xartifactItem.UnSavedAttr.Add(item3);
					}
				}
				xartifactItem.EffectInfoList.Clear();
				for (int k = 0; k < KKSGItem.effects.Count; k++)
				{
					EffectData effectData = KKSGItem.effects[k];
					XArtifactEffectInfo item4 = default(XArtifactEffectInfo);
					item4.Init();
					item4.EffectId = effectData.effectID;
					item4.SetBaseProf(effectData.effectID);
					item4.IsValid = effectData.isWork;
					xartifactItem.EffectInfoList.Add(item4);
					for (int l = 0; l < effectData.multiParams.Count; l++)
					{
						EffectMultiParams effectMultiParams = effectData.multiParams[l];
						bool flag4 = effectMultiParams == null;
						if (!flag4)
						{
							XArtifactBuffInfo item5 = default(XArtifactBuffInfo);
							item5.Init();
							item5.SetData(effectData.effectID, effectMultiParams.IDType, effectMultiParams.ID, effectMultiParams.effectParams);
							bool flag5 = item4.BuffInfoList.Count == 0;
							if (flag5)
							{
								item4.BuffInfoList.Add(item5);
							}
							else
							{
								for (int m = 0; m < item4.BuffInfoList.Count; m++)
								{
									bool flag6 = item5.SortId > item4.BuffInfoList[item4.BuffInfoList.Count - 1].SortId;
									if (flag6)
									{
										item4.BuffInfoList.Add(item5);
										break;
									}
									bool flag7 = item5.SortId < item4.BuffInfoList[m].SortId;
									if (flag7)
									{
										item4.BuffInfoList.Insert(m, item5);
										break;
									}
								}
							}
						}
					}
				}
			}
		}

		// Token: 0x060097B9 RID: 38841 RVA: 0x00172F88 File Offset: 0x00171188
		private static void MakeXEmblemItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				item = XDataPool<XEmblemItem>.GetData();
			}
			XBagDocument.MakeXAttrItem(ref item, KKSGItem);
			XEmblemItem xemblemItem = item as XEmblemItem;
			bool flag2 = xemblemItem == null;
			if (flag2)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Cant create XEmblemItem", null, null, null, null, null);
			}
			else
			{
				xemblemItem.smeltDegreeNum = KKSGItem.smeltCount;
				xemblemItem.emblemInfo.thirdslot = KKSGItem.EmblemThirdSlot;
			}
		}

		// Token: 0x060097BA RID: 38842 RVA: 0x00172FF8 File Offset: 0x001711F8
		private static void MakeXFashionItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				item = XDataPool<XFashionItem>.GetData();
			}
			XFashionItem xfashionItem = item as XFashionItem;
			xfashionItem.fashionLevel = KKSGItem.FashionLevel;
		}

		// Token: 0x060097BB RID: 38843 RVA: 0x0017302C File Offset: 0x0017122C
		private static void MakeXJadeItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				item = XDataPool<XJadeItem>.GetData();
			}
			XBagDocument.MakeXAttrItem(ref item, KKSGItem);
			XJadeItem xjadeItem = item as XJadeItem;
			bool flag2 = xjadeItem == null;
			if (flag2)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Cant create XJadeItem", null, null, null, null, null);
			}
		}

		// Token: 0x060097BC RID: 38844 RVA: 0x0017307C File Offset: 0x0017127C
		private static void MakeXAttrItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("XItem == null", null, null, null, null, null);
			}
			else
			{
				XAttrItem xattrItem = item as XAttrItem;
				bool flag2 = xattrItem == null;
				if (flag2)
				{
					XSingleton<XDebug>.singleton.AddErrorLog("Cant create XAttrItem", null, null, null, null, null);
				}
				else
				{
					xattrItem.changeAttr.Clear();
					for (int i = 0; i < KKSGItem.AttrID.Count; i++)
					{
						uint attrID = KKSGItem.AttrID[i];
						XItemChangeAttr item2;
						item2.AttrID = attrID;
						item2.AttrValue = KKSGItem.AttrValue[i];
						xattrItem.changeAttr.Add(item2);
					}
				}
			}
		}

		// Token: 0x060097BD RID: 38845 RVA: 0x00173138 File Offset: 0x00171338
		private static void MakeXLotteryBoxItem(ref XItem item, Item KKSGItem)
		{
			bool flag = item == null;
			if (flag)
			{
				item = XDataPool<XLotteryBoxItem>.GetData();
			}
			XLotteryBoxItem xlotteryBoxItem = item as XLotteryBoxItem;
			int num = 0;
			while (num < KKSGItem.circleDrawDatas.Count && num < XLotteryBoxItem.POOL_SIZE)
			{
				CircleDrawData circleDrawData = KKSGItem.circleDrawDatas[num];
				bool flag2 = (ulong)circleDrawData.index >= (ulong)((long)XLotteryBoxItem.POOL_SIZE);
				if (!flag2)
				{
					XItem xitem = xlotteryBoxItem.itemList[(int)circleDrawData.index];
					xitem.itemID = (int)circleDrawData.itemid;
					xitem.itemCount = (int)circleDrawData.itemcount;
				}
				num++;
			}
		}

		// Token: 0x060097BE RID: 38846 RVA: 0x001731D8 File Offset: 0x001713D8
		public static XItem MakeXItem(int itemID, bool bBinding = false)
		{
			ItemList.RowData itemConf = XBagDocument.GetItemConf(itemID);
			XItem xitem = null;
			bool flag = itemConf != null;
			if (flag)
			{
				ItemType itemType = (ItemType)itemConf.ItemType;
				ItemType itemType2 = itemType;
				switch (itemType2)
				{
				case ItemType.EQUIP:
					xitem = XDataPool<XEquipItem>.GetData();
					goto IL_7F;
				case ItemType.PECK:
				case ItemType.VIRTUAL_ITEM:
				case ItemType.MATERAIL:
					break;
				case ItemType.FASHION:
					xitem = XDataPool<XFashionItem>.GetData();
					goto IL_7F;
				case ItemType.EMBLEM:
					xitem = XDataPool<XEmblemItem>.GetData();
					goto IL_7F;
				case ItemType.JADE:
					xitem = XDataPool<XJadeItem>.GetData();
					goto IL_7F;
				default:
					if (itemType2 == ItemType.ARTIFACT)
					{
						xitem = XDataPool<XArtifactItem>.GetData();
						goto IL_7F;
					}
					break;
				}
				xitem = XDataPool<XNormalItem>.GetData();
				IL_7F:
				xitem.itemID = itemID;
				xitem.type = (uint)itemConf.ItemType;
				xitem.itemCount = (int)XBagDocument.BagDoc.GetItemCount(itemID);
				xitem.bBinding = bBinding;
				xitem.blocking = 0.0;
				xitem.itemConf = itemConf;
				ItemType itemType3 = itemType;
				switch (itemType3)
				{
				case ItemType.EQUIP:
				{
					EquipList.RowData equipConf = XBagDocument.GetEquipConf(itemID);
					bool flag2 = equipConf != null;
					if (flag2)
					{
						XEquipItem xequipItem = xitem as XEquipItem;
						for (int i = 0; i < equipConf.Attributes.Count; i++)
						{
							XItemChangeAttr item;
							item.AttrID = (uint)equipConf.Attributes[i, 0];
							item.AttrValue = (uint)equipConf.Attributes[i, 1];
							xequipItem.changeAttr.Add(item);
						}
						xequipItem.randAttrInfo.bPreview = true;
						xequipItem.forgeAttrInfo.bPreview = true;
					}
					break;
				}
				case ItemType.PECK:
				case ItemType.VIRTUAL_ITEM:
				case ItemType.MATERAIL:
					break;
				case ItemType.FASHION:
				{
					XFashionDocument specificDocument = XDocuments.GetSpecificDocument<XFashionDocument>(XFashionDocument.uuID);
					SeqListRef<uint> fashionAttr = specificDocument.GetFashionAttr(itemID, 0);
					XFashionItem xfashionItem = xitem as XFashionItem;
					xfashionItem.itemCount = 1;
					for (int j = 0; j < fashionAttr.Count; j++)
					{
						XItemChangeAttr item2;
						item2.AttrID = fashionAttr[j, 0];
						item2.AttrValue = fashionAttr[j, 1];
						xfashionItem.changeAttr.Add(item2);
					}
					break;
				}
				case ItemType.EMBLEM:
				{
					XEmblemItem xemblemItem = xitem as XEmblemItem;
					xemblemItem.emblemInfo.thirdslot = 10U;
					xemblemItem.emblemInfo.level = (uint)itemConf.ReqLevel;
					int num;
					int num2;
					XEquipCreateDocument.GetEmblemAttrDataByID((uint)xitem.itemID, out num, out num2);
					bool flag3 = num >= 0;
					if (flag3)
					{
						for (int k = num; k < num2; k++)
						{
							AttributeEmblem.RowData attributeEmblem = XEquipCreateDocument.GetAttributeEmblem(k);
							bool flag4 = attributeEmblem.Position == 1 || attributeEmblem.Position == 2;
							if (flag4)
							{
								XItemChangeAttr item3;
								item3.AttrID = (uint)attributeEmblem.AttrID;
								item3.AttrValue = attributeEmblem.Range[0];
								xemblemItem.changeAttr.Add(item3);
							}
						}
					}
					break;
				}
				case ItemType.JADE:
				{
					XJadeDocument specificDocument2 = XDocuments.GetSpecificDocument<XJadeDocument>(XJadeDocument.uuID);
					JadeTable.RowData byJadeID = specificDocument2.jadeTable.GetByJadeID((uint)itemID);
					bool flag5 = byJadeID != null;
					if (flag5)
					{
						XJadeItem xjadeItem = xitem as XJadeItem;
						for (int l = 0; l < byJadeID.JadeAttributes.Count; l++)
						{
							XItemChangeAttr item4;
							item4.AttrID = byJadeID.JadeAttributes[l, 0];
							item4.AttrValue = byJadeID.JadeAttributes[l, 1];
							xjadeItem.changeAttr.Add(item4);
						}
					}
					break;
				}
				default:
					if (itemType3 == ItemType.ARTIFACT)
					{
						XArtifactItem xartifactItem = xitem as XArtifactItem;
						xartifactItem.RandAttrInfo.bPreview = true;
					}
					break;
				}
			}
			else
			{
				XSingleton<XDebug>.singleton.AddErrorLog("Cant find item config for id: " + itemID.ToString(), null, null, null, null, null);
			}
			return xitem;
		}

		// Token: 0x060097BF RID: 38847 RVA: 0x001735A0 File Offset: 0x001717A0
		public static XItem MakeXItem(Item KKSGItem)
		{
			XItem xitem = null;
			ItemType itemType = (ItemType)KKSGItem.ItemType;
			ItemType itemType2 = itemType;
			switch (itemType2)
			{
			case ItemType.EQUIP:
				XBagDocument.MakeXEquipItem(ref xitem, KKSGItem);
				goto IL_8B;
			case ItemType.PECK:
			case ItemType.VIRTUAL_ITEM:
			case ItemType.MATERAIL:
			case ItemType.FRAGMENT:
				break;
			case ItemType.FASHION:
				XBagDocument.MakeXFashionItem(ref xitem, KKSGItem);
				goto IL_8B;
			case ItemType.EMBLEM:
				XBagDocument.MakeXEmblemItem(ref xitem, KKSGItem);
				goto IL_8B;
			case ItemType.JADE:
				XBagDocument.MakeXJadeItem(ref xitem, KKSGItem);
				goto IL_8B;
			case ItemType.LOTTERY_BOX:
				XBagDocument.MakeXLotteryBoxItem(ref xitem, KKSGItem);
				goto IL_8B;
			default:
				if (itemType2 == ItemType.ARTIFACT)
				{
					XBagDocument.MakeXArtifactItem(ref xitem, KKSGItem);
					goto IL_8B;
				}
				break;
			}
			xitem = XDataPool<XNormalItem>.GetData();
			IL_8B:
			xitem.uid = KKSGItem.uid;
			xitem.type = KKSGItem.ItemType;
			xitem.itemID = (int)KKSGItem.ItemID;
			xitem.itemCount = (int)KKSGItem.ItemCount;
			xitem.bBinding = KKSGItem.isbind;
			xitem.itemConf = XBagDocument.GetItemConf(xitem.itemID);
			bool flag = xitem.itemConf == null && xitem.uid > 0UL;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddGreenLog("Cant find item config for id: ", xitem.itemID.ToString(), ", uid = ", xitem.uid.ToString(), null, null);
			}
			xitem.bexpirationTime = KKSGItem.expirationTime;
			double num = 0.0;
			bool flag2 = KKSGItem.cooldown > 0U;
			if (flag2)
			{
				num = XSingleton<UiUtility>.singleton.TimeFormatLastTime(KKSGItem.cooldown, true);
				bool flag3 = num < 0.0;
				if (flag3)
				{
					num = 0.0;
				}
			}
			xitem.blocking = num;
			return xitem;
		}

		// Token: 0x060097C0 RID: 38848 RVA: 0x00173734 File Offset: 0x00171934
		public static XItem MakeFasionItemById(uint id)
		{
			XItem data = XDataPool<XFashionItem>.GetData();
			data.uid = 0UL;
			data.type = 5U;
			data.itemID = (int)id;
			data.itemCount = 1;
			return data;
		}

		// Token: 0x060097C1 RID: 38849 RVA: 0x0017376C File Offset: 0x0017196C
		public bool GetBodyPosByUID(ulong uid, out int pos, out XBodyBag bag, out bool isEquip)
		{
			bool itemPos = this.EquipBag.GetItemPos(uid, out pos);
			bool result;
			if (itemPos)
			{
				bag = this.EquipBag;
				isEquip = true;
				result = true;
			}
			else
			{
				bool itemPos2 = this.EmblemBag.GetItemPos(uid, out pos);
				if (itemPos2)
				{
					bag = this.EmblemBag;
					isEquip = false;
					result = true;
				}
				else
				{
					bool itemPos3 = this.ArtifactBag.GetItemPos(uid, out pos);
					if (itemPos3)
					{
						bag = this.ArtifactBag;
						isEquip = false;
						result = true;
					}
					else
					{
						bag = null;
						pos = -1;
						isEquip = false;
						result = false;
					}
				}
			}
			return result;
		}

		// Token: 0x060097C2 RID: 38850 RVA: 0x001737F0 File Offset: 0x001719F0
		public XItem GetBodyItemByUID(ulong uid)
		{
			XItem itemByUID = this.EquipBag.GetItemByUID(uid);
			bool flag = itemByUID != null;
			XItem result;
			if (flag)
			{
				result = itemByUID;
			}
			else
			{
				itemByUID = this.EmblemBag.GetItemByUID(uid);
				bool flag2 = itemByUID != null;
				if (flag2)
				{
					result = itemByUID;
				}
				else
				{
					itemByUID = this.ArtifactBag.GetItemByUID(uid);
					bool flag3 = itemByUID != null;
					if (flag3)
					{
						result = itemByUID;
					}
					else
					{
						result = null;
					}
				}
			}
			return result;
		}

		// Token: 0x060097C3 RID: 38851 RVA: 0x00173850 File Offset: 0x00171A50
		public XItem GetBodyItemByID(int id)
		{
			XItem itemByID = this.EquipBag.GetItemByID(id);
			bool flag = itemByID != null;
			XItem result;
			if (flag)
			{
				result = itemByID;
			}
			else
			{
				itemByID = this.EmblemBag.GetItemByID(id);
				bool flag2 = itemByID != null;
				if (flag2)
				{
					result = itemByID;
				}
				else
				{
					itemByID = this.ArtifactBag.GetItemByID(id);
					bool flag3 = itemByID != null;
					if (flag3)
					{
						result = itemByID;
					}
					else
					{
						result = null;
					}
				}
			}
			return result;
		}

		// Token: 0x060097C4 RID: 38852 RVA: 0x001738B0 File Offset: 0x00171AB0
		public int GetBodyItemCountByID(int id)
		{
			int itemCountByID = this.EquipBag.GetItemCountByID(id);
			bool flag = itemCountByID == 0;
			if (flag)
			{
				itemCountByID = this.EmblemBag.GetItemCountByID(id);
			}
			bool flag2 = itemCountByID == 0;
			if (flag2)
			{
				itemCountByID = this.ArtifactBag.GetItemCountByID(id);
			}
			return itemCountByID;
		}

		// Token: 0x060097C5 RID: 38853 RVA: 0x001738FC File Offset: 0x00171AFC
		public XItem GetBagItemByUID(ulong uid)
		{
			int key = 0;
			bool flag = this.ItemBag.FindItem(uid, out key);
			XItem result;
			if (flag)
			{
				result = this.ItemBag[key];
			}
			else
			{
				result = null;
			}
			return result;
		}

		// Token: 0x060097C6 RID: 38854 RVA: 0x00173934 File Offset: 0x00171B34
		public XItem GetBagItemByUID(string struid)
		{
			ulong uid = 0UL;
			bool flag = ulong.TryParse(struid, out uid);
			XItem result;
			if (flag)
			{
				result = this.GetBagItemByUID(uid);
			}
			else
			{
				result = null;
			}
			return result;
		}

		// Token: 0x060097C7 RID: 38855 RVA: 0x00173964 File Offset: 0x00171B64
		public XItem GetItemByUID(ulong uid)
		{
			int key = 0;
			XItem bodyItemByUID = this.GetBodyItemByUID(uid);
			bool flag = bodyItemByUID != null;
			XItem result;
			if (flag)
			{
				result = bodyItemByUID;
			}
			else
			{
				bool flag2 = this.ItemBag.FindItem(uid, out key);
				if (flag2)
				{
					result = this.ItemBag[key];
				}
				else
				{
					result = null;
				}
			}
			return result;
		}

		// Token: 0x060097C8 RID: 38856 RVA: 0x001739B4 File Offset: 0x00171BB4
		public XItem GetItemByUID(string struid)
		{
			ulong uid = 0UL;
			bool flag = ulong.TryParse(struid, out uid);
			XItem result;
			if (flag)
			{
				result = this.GetItemByUID(uid);
			}
			else
			{
				result = null;
			}
			return result;
		}

		// Token: 0x060097C9 RID: 38857 RVA: 0x001739E4 File Offset: 0x00171BE4
		public bool GetItemByItemId(int itemId, out List<XItem> lst)
		{
			return this.ItemBag.FindItemByID(itemId, out lst);
		}

		// Token: 0x060097CA RID: 38858 RVA: 0x00173A04 File Offset: 0x00171C04
		private static int ItemType2Int(ItemType type)
		{
			return XFastEnumIntEqualityComparer<ItemType>.ToInt(type);
		}

		// Token: 0x060097CB RID: 38859 RVA: 0x00173A1C File Offset: 0x00171C1C
		public static int BodyPosition<T>(T type) where T : struct
		{
			return XFastEnumIntEqualityComparer<T>.ToInt(type);
		}

		// Token: 0x060097CC RID: 38860 RVA: 0x00173A34 File Offset: 0x00171C34
		internal static void InitAddEquiptItem(ref XBodyBag bag, List<Item> list, int bagSize)
		{
			bool flag = bag == null;
			if (flag)
			{
				bag = new XBodyBag(bagSize);
			}
			for (int i = 0; i < bag.Length; i++)
			{
				bool flag2 = bag[i] != null;
				if (flag2)
				{
					bag[i].Recycle();
					bag[i] = null;
				}
			}
			int num = Math.Min(list.Count, bag.Length);
			for (int j = 0; j < num; j++)
			{
				XItem xitem = XBagDocument.MakeXItem(list[j]);
				bool flag3 = xitem.itemID == 0;
				if (flag3)
				{
					xitem.Recycle();
					xitem = null;
				}
				bag[j] = xitem;
			}
		}

		// Token: 0x060097CD RID: 38861 RVA: 0x00173AFC File Offset: 0x00171CFC
		internal void Init(BagContent Bag)
		{
			XEmblemDocument.HadSlottingNum = (int)Bag.extraSkillEbSlotNum;
			for (int i = 0; i < Bag.expand.Count; i++)
			{
				this.SetBagExpandData(Bag.expand[i], false);
			}
			XBagDocument.InitAddEquiptItem(ref this.EquipBag, Bag.Equips, XBagDocument.EquipMax);
			XBagDocument.InitAddEquiptItem(ref this.EmblemBag, Bag.Emblems, XBagDocument.EmblemMax);
			XBagDocument.InitAddEquiptItem(ref this.ArtifactBag, Bag.Artifacts, XBagDocument.ArtifactMax);
			int count = this.ItemBag.Count;
			for (int j = 0; j < count; j++)
			{
				this.ItemBag[j].Recycle();
			}
			this.ItemBag.Clear();
			for (int k = 0; k < Bag.Items.Count; k++)
			{
				XItem item = XBagDocument.MakeXItem(Bag.Items[k]);
				this.ItemBag.AddItem(item, false);
			}
			int l;
			for (l = 0; l < Bag.virtualitems.Count; l++)
			{
				this.VirtualItems[l] = Bag.virtualitems[l];
			}
			while (l < this.VirtualItems.Length)
			{
				this.VirtualItems[l] = 0UL;
				l++;
			}
			this.ItemBag.SortItem();
			XJadeDocument specificDocument = XDocuments.GetSpecificDocument<XJadeDocument>(XJadeDocument.uuID);
			specificDocument.UpdateRedPoints();
			XEnhanceDocument specificDocument2 = XDocuments.GetSpecificDocument<XEnhanceDocument>(XEnhanceDocument.uuID);
			specificDocument2.UpdateRedPoints();
			XEnchantDocument specificDocument3 = XDocuments.GetSpecificDocument<XEnchantDocument>(XEnchantDocument.uuID);
			specificDocument3.UpdateRedPoints();
			XSingleton<XAttributeMgr>.singleton.XPlayerData.Outlook.enhanceMasterLevel = Bag.enhanceSuit;
			XSingleton<XAttributeMgr>.singleton.XPlayerData.EmblemBag = this.EmblemBag;
			this.TearsCount = (ulong)((long)this.ItemBag.GetItemCount(88));
		}

		// Token: 0x060097CE RID: 38862 RVA: 0x00173CF8 File Offset: 0x00171EF8
		public void SetBagExpandData(KKSG.BagExpandData data, bool isShowTip)
		{
			for (int i = 0; i < this.BagExpandDataList.Count; i++)
			{
				bool flag = this.BagExpandDataList[i].Type == data.type;
				if (flag)
				{
					this.BagExpandDataList[i].ExpandNum = data.num;
					this.BagExpandDataList[i].ExpandTimes = data.count;
					if (isShowTip)
					{
						switch (data.type)
						{
						case BagType.EquipBag:
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("ExpandEquipBagSuc"), "fece00");
							XCharacterEquipDocument specificDocument = XDocuments.GetSpecificDocument<XCharacterEquipDocument>(XCharacterEquipDocument.uuID);
							specificDocument.RefreshBag();
							break;
						}
						case BagType.EmblemBag:
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("ExpandEmblemBagSuc"), "fece00");
							XEmblemDocument specificDocument2 = XDocuments.GetSpecificDocument<XEmblemDocument>(XEmblemDocument.uuID);
							specificDocument2.RefreshBag();
							break;
						}
						case BagType.ArtifactBag:
							XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("ExpandArtifactBagSuc"), "fece00");
							ArtifactBagDocument.Doc.RefreshBag();
							break;
						case BagType.ItemBag:
						{
							XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<XStringTable>.singleton.GetString("ExpandItemBagSuc"), "fece00");
							XCharacterItemDocument specificDocument3 = XDocuments.GetSpecificDocument<XCharacterItemDocument>(XCharacterItemDocument.uuID);
							specificDocument3.RefreshBag();
							break;
						}
						}
					}
					break;
				}
			}
		}

		// Token: 0x060097CF RID: 38863 RVA: 0x00173E78 File Offset: 0x00172078
		public void UseBagExpandTicket(BagType type)
		{
			BagExpandItemListTable.RowData expandItemConfByType = XBagDocument.GetExpandItemConfByType((uint)XFastEnumIntEqualityComparer<BagType>.ToInt(type));
			bool flag = expandItemConfByType == null;
			if (!flag)
			{
				this.m_usedBagExpandRow = expandItemConfByType;
				int itemId = (int)expandItemConfByType.ItemId;
				BagExpandData bagExpandData = XBagDocument.BagDoc.GetBagExpandData((BagType)expandItemConfByType.Type);
				bool flag2 = bagExpandData != null;
				if (flag2)
				{
					bool flag3 = (uint)expandItemConfByType.NeedAndOpen.count > bagExpandData.ExpandTimes;
					if (flag3)
					{
						ItemList.RowData itemConf = XBagDocument.GetItemConf(itemId);
						XSingleton<UiUtility>.singleton.ShowModalDialog(string.Format(XSingleton<XStringTable>.singleton.GetString("BagExpandSureTips"), expandItemConfByType.NeedAndOpen[(int)bagExpandData.ExpandTimes, 0], itemConf.ItemName[0], expandItemConfByType.NeedAndOpen[(int)bagExpandData.ExpandTimes, 1]), XStringDefineProxy.GetString("COMMON_OK"), XStringDefineProxy.GetString("COMMON_CANCEL"), new ButtonClickEventHandler(this.ReqUseBagExpandTicket));
					}
					else
					{
						XSingleton<UiUtility>.singleton.ShowSystemTip(XSingleton<UiUtility>.singleton.GetBagExpandFullTips((BagType)expandItemConfByType.Type), "fece00");
					}
				}
			}
		}

		// Token: 0x060097D0 RID: 38864 RVA: 0x00173F90 File Offset: 0x00172190
		private bool ReqUseBagExpandTicket(IXUIButton btn)
		{
			BagExpandItemListTable.RowData usedBagExpandRow = this.m_usedBagExpandRow;
			bool flag = usedBagExpandRow == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				int itemId = (int)usedBagExpandRow.ItemId;
				BagExpandData bagExpandData = XBagDocument.BagDoc.GetBagExpandData((BagType)usedBagExpandRow.Type);
				bool flag2 = bagExpandData != null;
				if (flag2)
				{
					ulong itemCount = XBagDocument.BagDoc.GetItemCount(itemId);
					bool flag3 = itemCount >= (ulong)usedBagExpandRow.NeedAndOpen[(int)bagExpandData.ExpandTimes, 0] && itemCount > 0UL;
					if (flag3)
					{
						List<XItem> list;
						bool itemByItemId = this.GetItemByItemId(itemId, out list);
						if (itemByItemId)
						{
							XSingleton<XGame>.singleton.Doc.XBagDoc.UseItem(list[0], 0U);
						}
					}
					else
					{
						XSingleton<UiUtility>.singleton.ShowItemAccess(itemId, null);
					}
				}
				XSingleton<UiUtility>.singleton.CloseModalDlg();
				result = true;
			}
			return result;
		}

		// Token: 0x060097D1 RID: 38865 RVA: 0x00174060 File Offset: 0x00172260
		internal ulong GetItemCount(int itemid)
		{
			bool flag = itemid < XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.VIRTUAL_ITEM_MAX);
			ulong result;
			if (flag)
			{
				result = this.GetVirtualItemCount((ItemEnum)itemid);
			}
			else
			{
				result = (ulong)((long)this.ItemBag.GetItemCount(itemid));
			}
			return result;
		}

		// Token: 0x060097D2 RID: 38866 RVA: 0x00174098 File Offset: 0x00172298
		internal ulong GetItemCount(int itemid, bool isBind)
		{
			bool flag = itemid < XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.VIRTUAL_ITEM_MAX);
			ulong result;
			if (flag)
			{
				result = this.GetVirtualItemCount((ItemEnum)itemid);
			}
			else
			{
				result = (ulong)((long)this.ItemBag.GetItemCount(itemid, isBind));
			}
			return result;
		}

		// Token: 0x060097D3 RID: 38867 RVA: 0x001740D0 File Offset: 0x001722D0
		internal ulong GetVirtualItemCount(ItemEnum t)
		{
			return this.VirtualItems[XFastEnumIntEqualityComparer<ItemEnum>.ToInt(t)];
		}

		// Token: 0x060097D4 RID: 38868 RVA: 0x001740F0 File Offset: 0x001722F0
		internal ulong GetSkillPointCount(bool isAwakeSkillPoint = false)
		{
			bool flag = XSingleton<XAttributeMgr>.singleton.XPlayerData.SkillPageIndex == 0U;
			ulong result;
			if (flag)
			{
				result = this.VirtualItems[XFastEnumIntEqualityComparer<ItemEnum>.ToInt(isAwakeSkillPoint ? ItemEnum.AWAKE_SKILL_POINT : ItemEnum.SKILL_POINT)];
			}
			else
			{
				result = this.VirtualItems[XFastEnumIntEqualityComparer<ItemEnum>.ToInt(isAwakeSkillPoint ? ItemEnum.AWAKE_SKILL_POINT_TWO : ItemEnum.SKILL_POINT_TWO)];
			}
			return result;
		}

		// Token: 0x060097D5 RID: 38869 RVA: 0x00174144 File Offset: 0x00172344
		internal void SetVirtualItemCount(int t, ulong Count)
		{
			ulong oldValue = 0UL;
			bool flag = t < XFastEnumIntEqualityComparer<ItemEnum>.ToInt(ItemEnum.VIRTUAL_ITEM_MAX);
			if (flag)
			{
				oldValue = this.VirtualItems[t];
				this.VirtualItems[t] = Count;
			}
			else
			{
				bool flag2 = t == 88;
				if (flag2)
				{
					oldValue = this.TearsCount;
					this.TearsCount = Count;
				}
			}
			bool flag3 = t == 6;
			if (flag3)
			{
				XSingleton<XDebug>.singleton.AddLog("Set fatigue = ", Count.ToString(), null, null, null, null, XDebugColor.XDebug_None);
			}
			XVirtualItemChangedEventArgs @event = XEventPool<XVirtualItemChangedEventArgs>.GetEvent();
			@event.e = (ItemEnum)t;
			@event.newValue = Count;
			@event.oldValue = oldValue;
			@event.itemID = t;
			@event.Firer = XSingleton<XGame>.singleton.Doc;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
		}

		// Token: 0x060097D6 RID: 38870 RVA: 0x001741FC File Offset: 0x001723FC
		internal void UpdateItem(Item KKSGItem)
		{
			XItem xitem = XBagDocument.MakeXItem(KKSGItem);
			int key;
			bool flag = this.ItemBag.FindItem(xitem.uid, out key);
			if (flag)
			{
				this.ItemBag[key].Recycle();
				this.ItemBag[key] = xitem;
			}
			else
			{
				bool flag2 = xitem.Type == ItemType.EQUIP;
				if (flag2)
				{
					this.EquipBag.UpdateItem(xitem);
				}
				else
				{
					bool flag3 = xitem.Type == ItemType.EMBLEM;
					if (flag3)
					{
						this.EmblemBag.UpdateItem(xitem);
					}
					else
					{
						bool flag4 = xitem.Type == ItemType.ARTIFACT;
						if (flag4)
						{
							this.ArtifactBag.UpdateItem(xitem);
						}
					}
				}
			}
			XUpdateItemEventArgs @event = XEventPool<XUpdateItemEventArgs>.GetEvent();
			@event.item = xitem;
			@event.Firer = XSingleton<XGame>.singleton.Doc;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
		}

		// Token: 0x060097D7 RID: 38871 RVA: 0x001742D4 File Offset: 0x001724D4
		internal void AddNewItem(Item KKSGItem)
		{
			XItem item = XBagDocument.MakeXItem(KKSGItem);
			this.ItemBag.AddItem(item, true);
			XAddItemEventArgs @event = XEventPool<XAddItemEventArgs>.GetEvent();
			@event.items.Add(item);
			@event.Firer = XSingleton<XGame>.singleton.Doc;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
		}

		// Token: 0x060097D8 RID: 38872 RVA: 0x00174328 File Offset: 0x00172528
		internal void AddNewItem(List<Item> KKSGItems, bool bIsNew = true)
		{
			XAddItemEventArgs @event = XEventPool<XAddItemEventArgs>.GetEvent();
			@event.Firer = XSingleton<XGame>.singleton.Doc;
			@event.bNew = bIsNew;
			foreach (Item kksgitem in KKSGItems)
			{
				XItem item = XBagDocument.MakeXItem(kksgitem);
				this.ItemBag.AddItem(item, false);
				@event.items.Add(item);
			}
			bool flag = @event.items.Count > 0;
			if (flag)
			{
				this.ItemBag.SortItem();
				XSingleton<XEventMgr>.singleton.FireEvent(@event);
			}
			else
			{
				@event.Recycle();
			}
		}

		// Token: 0x060097D9 RID: 38873 RVA: 0x001743EC File Offset: 0x001725EC
		internal void RemoveItem(ulong uid)
		{
			int num;
			bool flag = this.ItemBag.FindItem(uid, out num);
			if (flag)
			{
				XRemoveItemEventArgs @event = XEventPool<XRemoveItemEventArgs>.GetEvent();
				@event.uids.Add(uid);
				@event.types.Add(this.ItemBag[num].Type);
				@event.ids.Add(this.ItemBag[num].itemID);
				this.ItemBag.RemoveIndex(num);
				@event.Firer = XSingleton<XGame>.singleton.Doc;
			}
		}

		// Token: 0x060097DA RID: 38874 RVA: 0x0017447C File Offset: 0x0017267C
		internal void RemoveItem(List<ulong> uids)
		{
			XRemoveItemEventArgs @event = XEventPool<XRemoveItemEventArgs>.GetEvent();
			@event.Firer = XSingleton<XGame>.singleton.Doc;
			foreach (ulong num in uids)
			{
				int num2;
				bool flag = this.ItemBag.FindItem(num, out num2);
				if (flag)
				{
					XItem xitem = this.ItemBag[num2];
					@event.uids.Add(num);
					@event.types.Add(xitem.Type);
					@event.ids.Add(xitem.itemID);
					xitem.Recycle();
					this.ItemBag.RemoveIndex(num2);
				}
			}
			bool flag2 = @event.uids.Count > 0;
			if (flag2)
			{
				XSingleton<XEventMgr>.singleton.FireEvent(@event);
			}
			else
			{
				@event.Recycle();
			}
		}

		// Token: 0x060097DB RID: 38875 RVA: 0x00174574 File Offset: 0x00172774
		internal void ChangeItemCount(ulong uid, int count, bool bIsNew = true)
		{
			int key;
			bool flag = this.ItemBag.FindItem(uid, out key);
			if (flag)
			{
				XItem xitem = this.ItemBag[key];
				int itemCount = xitem.itemCount;
				xitem.itemCount = count;
				XItemNumChangedEventArgs @event = XEventPool<XItemNumChangedEventArgs>.GetEvent();
				@event.oldCount = itemCount;
				@event.item = xitem;
				@event.Firer = XSingleton<XGame>.singleton.Doc;
				@event.bNew = bIsNew;
				XSingleton<XEventMgr>.singleton.FireEvent(@event);
			}
		}

		// Token: 0x060097DC RID: 38876 RVA: 0x001745F0 File Offset: 0x001727F0
		internal void FinishItemChange()
		{
			XItemChangeFinishedEventArgs @event = XEventPool<XItemChangeFinishedEventArgs>.GetEvent();
			@event.Firer = XSingleton<XGame>.singleton.Doc;
			XSingleton<XEventMgr>.singleton.FireEvent(@event);
		}

		// Token: 0x060097DD RID: 38877 RVA: 0x00174621 File Offset: 0x00172821
		private void _RemoveCompareAttrsFromPool(ulong uid)
		{
			this.basicAttrPool.Remove(uid);
			this.equipAdditionalAttrPool.Remove(uid);
		}

		// Token: 0x060097DE RID: 38878 RVA: 0x00174640 File Offset: 0x00172840
		public uint GetItemPPT(XAttrItem item, ItemAttrCompareType type)
		{
			bool flag = item == null;
			uint result;
			if (flag)
			{
				result = 0U;
			}
			else
			{
				Dictionary<ulong, uint> dictionary = null;
				if (type != ItemAttrCompareType.IACT_SELF)
				{
					if (type == ItemAttrCompareType.IACT_TOTAL)
					{
						dictionary = this.equipAdditionalAttrPool;
					}
				}
				else
				{
					dictionary = this.basicAttrPool;
				}
				uint num = 0U;
				ulong num2 = item.uid;
				bool flag2 = num2 == 0UL;
				if (flag2)
				{
					num2 = (ulong)((long)item.itemID);
				}
				bool flag3 = !dictionary.TryGetValue(num2, out num);
				if (flag3)
				{
					XEquipItem xequipItem = item as XEquipItem;
					double num3 = 0.0;
					bool flag4 = (type & ItemAttrCompareType.IACT_BASIC) > (ItemAttrCompareType)0;
					if (flag4)
					{
						for (int i = 0; i < item.changeAttr.Count; i++)
						{
							num3 += XSingleton<XPowerPointCalculator>.singleton.GetPPT(item.changeAttr[i], null, -1);
						}
					}
					bool flag5 = xequipItem != null && (type & ItemAttrCompareType.IACT_RANDOM) > (ItemAttrCompareType)0;
					if (flag5)
					{
						for (int j = 0; j < xequipItem.randAttrInfo.RandAttr.Count; j++)
						{
							num3 += XSingleton<XPowerPointCalculator>.singleton.GetPPT(xequipItem.randAttrInfo.RandAttr[j], null, -1);
						}
					}
					bool flag6 = xequipItem != null && (type & ItemAttrCompareType.IACT_FORGE) > (ItemAttrCompareType)0;
					if (flag6)
					{
						for (int k = 0; k < xequipItem.forgeAttrInfo.ForgeAttr.Count; k++)
						{
							num3 += XSingleton<XPowerPointCalculator>.singleton.GetPPT(xequipItem.forgeAttrInfo.ForgeAttr[k], null, -1);
						}
					}
					bool flag7 = xequipItem != null && (type & ItemAttrCompareType.IACT_ENHANCE) > (ItemAttrCompareType)0;
					if (flag7)
					{
						for (int l = 0; l < xequipItem.enhanceInfo.EnhanceAttr.Count; l++)
						{
							num3 += XSingleton<XPowerPointCalculator>.singleton.GetPPT(xequipItem.enhanceInfo.EnhanceAttr[l], null, -1);
						}
					}
					bool flag8 = xequipItem != null && (type & ItemAttrCompareType.IACT_JADE) > (ItemAttrCompareType)0;
					if (flag8)
					{
						for (int m = 0; m < xequipItem.jadeInfo.jades.Length; m++)
						{
							num3 += this.GetItemPPT(xequipItem.jadeInfo.jades[m], ItemAttrCompareType.IACT_SELF);
						}
					}
					num = (uint)num3;
					dictionary.Add(num2, num);
				}
				result = num;
			}
			return result;
		}

		// Token: 0x060097DF RID: 38879 RVA: 0x001748AC File Offset: 0x00172AAC
		public override void Update(float fDeltaT)
		{
			bool flag = this.ItemBag == null;
			if (!flag)
			{
				int i = 0;
				int count = this.ItemBag.Count;
				while (i < count)
				{
					bool flag2 = !this.ItemBag[i].bBinding && this.ItemBag[i].blocking > 0.0;
					if (flag2)
					{
						this.ItemBag[i].blocking -= (double)fDeltaT;
					}
					i++;
				}
				bool flag3 = this.getallEquip;
				if (flag3)
				{
					this.fashionTime += fDeltaT;
					bool flag4 = this.fashionTime > 0.3f;
					if (flag4)
					{
						this.fashionTime = 0f;
						bool flag5 = this.fashionIndex < XBagDocument.m_FashionTable.Table.Length;
						if (flag5)
						{
							FashionList.RowData[] table = XBagDocument.m_FashionTable.Table;
							int num = this.fashionIndex;
							this.fashionIndex = num + 1;
							FashionList.RowData rowData = table[num];
							string command = string.Format("item {0} 1", rowData.ItemID);
							XSingleton<XCommand>.singleton.ProcessCommand(command);
						}
						else
						{
							this.getallEquip = false;
						}
					}
				}
			}
		}

		// Token: 0x060097E0 RID: 38880 RVA: 0x001749EC File Offset: 0x00172BEC
		public ItemAttrCompareResult IsAttrMorePowerful(XAttrItem left, XAttrItem right, ItemAttrCompareType type = ItemAttrCompareType.IACT_SELF)
		{
			uint itemPPT = this.GetItemPPT(left, type);
			uint itemPPT2 = this.GetItemPPT(right, type);
			bool flag = itemPPT < itemPPT2;
			ItemAttrCompareResult result;
			if (flag)
			{
				result = ItemAttrCompareResult.IACR_SMALLER;
			}
			else
			{
				bool flag2 = itemPPT > itemPPT2;
				if (flag2)
				{
					result = ItemAttrCompareResult.IACR_LARGER;
				}
				else
				{
					result = ItemAttrCompareResult.IACR_EQUAL;
				}
			}
			return result;
		}

		// Token: 0x060097E1 RID: 38881 RVA: 0x00174A2C File Offset: 0x00172C2C
		public uint GetArtifactPPT(XAttrItem item)
		{
			bool flag = item == null;
			uint result;
			if (flag)
			{
				result = 0U;
			}
			else
			{
				XArtifactItem xartifactItem = item as XArtifactItem;
				bool flag2 = xartifactItem == null;
				if (flag2)
				{
					result = 0U;
				}
				else
				{
					double num = 0.0;
					for (int i = 0; i < xartifactItem.RandAttrInfo.RandAttr.Count; i++)
					{
						bool flag3 = xartifactItem.RandAttrInfo.RandAttr[i].AttrID == 0U;
						if (!flag3)
						{
							num += XSingleton<XPowerPointCalculator>.singleton.GetPPT(xartifactItem.RandAttrInfo.RandAttr[i], null, -1);
						}
					}
					result = (uint)num;
				}
			}
			return result;
		}

		// Token: 0x060097E2 RID: 38882 RVA: 0x00174AD8 File Offset: 0x00172CD8
		public void ReqItemSell(ulong uid)
		{
			RpcC2G_ItemSell rpcC2G_ItemSell = new RpcC2G_ItemSell();
			rpcC2G_ItemSell.oArg.uid = uid;
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_ItemSell);
		}

		// Token: 0x060097E3 RID: 38883 RVA: 0x00174B08 File Offset: 0x00172D08
		public void ReqItemCompose(ulong uid)
		{
			RpcC2G_ItemCompose rpcC2G_ItemCompose = new RpcC2G_ItemCompose();
			rpcC2G_ItemCompose.oArg.uid = uid.ToString();
			XSingleton<XClientNetwork>.singleton.Send(rpcC2G_ItemCompose);
		}

		// Token: 0x060097E4 RID: 38884 RVA: 0x00174B3C File Offset: 0x00172D3C
		public static bool ItemCanShowTips(uint itemID)
		{
			ItemList.RowData itemConf = XBagDocument.GetItemConf((int)itemID);
			bool flag = itemConf == null;
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				bool flag2 = itemConf.ShowTips == 0;
				result = !flag2;
			}
			return result;
		}

		// Token: 0x060097E5 RID: 38885 RVA: 0x00174B74 File Offset: 0x00172D74
		protected override void OnReconnected(XReconnectedEventArgs arg)
		{
			this.Init(arg.PlayerInfo.Bag);
			bool flag = XSingleton<XEntityMgr>.singleton.Player == null;
			if (!flag)
			{
				XEquipComponent xequipComponent = XSingleton<XEntityMgr>.singleton.Player.GetXComponent(XEquipComponent.uuID) as XEquipComponent;
				bool flag2 = xequipComponent != null;
				if (flag2)
				{
					xequipComponent.EquipFromAttr();
				}
			}
		}

		// Token: 0x060097E6 RID: 38886 RVA: 0x00174BD2 File Offset: 0x00172DD2
		public void GetAllEquip()
		{
			this.getallEquip = true;
			this.fashionIndex = 0;
			this.fashionTime = 0.4f;
		}

		// Token: 0x040033EA RID: 13290
		public new static readonly uint uuID = XSingleton<XCommon>.singleton.XHash("XBagDocument");

		// Token: 0x040033EB RID: 13291
		public static XTableAsyncLoader AsyncLoader = new XTableAsyncLoader();

		// Token: 0x040033EC RID: 13292
		private static ItemList m_ItemTable = new ItemList();

		// Token: 0x040033ED RID: 13293
		private static DropList m_DropTable = new DropList();

		// Token: 0x040033EE RID: 13294
		private static ChestList m_ChestTable = new ChestList();

		// Token: 0x040033EF RID: 13295
		private static EquipList m_EquipTable = new EquipList();

		// Token: 0x040033F0 RID: 13296
		private static EmblemBasic m_EmblemTable = new EmblemBasic();

		// Token: 0x040033F1 RID: 13297
		private static FashionList m_FashionTable = new FashionList();

		// Token: 0x040033F2 RID: 13298
		private static PandoraHeart m_PandoraHeartTable = new PandoraHeart();

		// Token: 0x040033F3 RID: 13299
		private static BagExpandItemListTable m_BagExpandItemListTable = new BagExpandItemListTable();

		// Token: 0x040033F4 RID: 13300
		private static Dictionary<int, List<ChestList.RowData>> m_ChestRange = new Dictionary<int, List<ChestList.RowData>>();

		// Token: 0x040033F5 RID: 13301
		private static Dictionary<uint, List<ItemList.RowData>> m_AuctionRange = new Dictionary<uint, List<ItemList.RowData>>();

		// Token: 0x040033F6 RID: 13302
		public XBag ItemBag;

		// Token: 0x040033F7 RID: 13303
		public static readonly int EquipMax = XBagDocument.BodyPosition<EquipPosition>(EquipPosition.EQUIP_END);

		// Token: 0x040033F8 RID: 13304
		public static readonly int FashionMax = XBagDocument.BodyPosition<FashionPosition>(FashionPosition.FASHION_END);

		// Token: 0x040033F9 RID: 13305
		public static readonly int EmblemMax = XBagDocument.BodyPosition<EmblemPosition>(EmblemPosition.EMBLEM_END);

		// Token: 0x040033FA RID: 13306
		public static readonly int VirtualItemMax = XBagDocument.BodyPosition<ItemEnum>(ItemEnum.VIRTUAL_ITEM_MAX);

		// Token: 0x040033FB RID: 13307
		public static readonly int ArtifactMax = XBagDocument.BodyPosition<ArtifactPosition>(ArtifactPosition.ARTIFACT_END);

		// Token: 0x040033FC RID: 13308
		private static readonly uint ITEM_PROFESSION_MASK = 100000U;

		// Token: 0x040033FD RID: 13309
		public static readonly int QualityCount = 6;

		// Token: 0x040033FE RID: 13310
		public XBodyBag EquipBag = new XBodyBag(XBagDocument.EquipMax);

		// Token: 0x040033FF RID: 13311
		public XBodyBag EmblemBag = new XBodyBag(XBagDocument.EmblemMax);

		// Token: 0x04003400 RID: 13312
		public XBodyBag ArtifactBag = new XBodyBag(XBagDocument.ArtifactMax);

		// Token: 0x04003401 RID: 13313
		public ulong[] VirtualItems = new ulong[XBagDocument.VirtualItemMax];

		// Token: 0x04003402 RID: 13314
		public ulong TearsCount = 0UL;

		// Token: 0x04003403 RID: 13315
		public List<BagExpandData> BagExpandDataList = new List<BagExpandData>
		{
			new BagExpandData(BagType.ItemBag),
			new BagExpandData(BagType.EmblemBag),
			new BagExpandData(BagType.EquipBag),
			new BagExpandData(BagType.ArtifactBag)
		};

		// Token: 0x04003404 RID: 13316
		public static CVSReader.RowDataCompare<DropList.RowData, int> comp = new CVSReader.RowDataCompare<DropList.RowData, int>(XBagDocument.DropDataCompare);

		// Token: 0x04003405 RID: 13317
		private BagExpandItemListTable.RowData m_usedBagExpandRow = null;

		// Token: 0x04003406 RID: 13318
		private Dictionary<ulong, uint> basicAttrPool = new Dictionary<ulong, uint>();

		// Token: 0x04003407 RID: 13319
		private Dictionary<ulong, uint> equipAdditionalAttrPool = new Dictionary<ulong, uint>();

		// Token: 0x04003408 RID: 13320
		private bool getallEquip = false;

		// Token: 0x04003409 RID: 13321
		private int fashionIndex = 0;

		// Token: 0x0400340A RID: 13322
		private float fashionTime = 0f;
	}
}
